"""区块链适配器模块

本模块包含各种区块链平台的适配器实现，提供统一的接口来操作不同的区块链网络。

支持的区块链平台：
- FISCO BCOS: 金融级联盟区块链平台
- ChainMaker: 长安链区块链平台
- JD Chain: 京东区块链平台
- XuperChain: 百度超级链平台

- Ethereum: 以太坊公链平台
- Thanos Chain: 天玄链区块链平台

每个适配器都实现了统一的IBlockchainAdapter接口，确保操作的一致性。

Author: Blockchain Middleware Team
Version: 1.0.0
Date: 2024
"""

from .base_adapter import IBlockchainAdapter, BaseBlockchainAdapter
from .fisco_bcos_adapter import FiscoBcosAdapter
from .chainmaker_adapter import ChainMakerAdapter
from .jdchain_adapter import JDChainAdapter
from .xuperchain_adapter import XuperChainAdapter
from .thanos_adapter import ThanosAdapter

__version__ = '1.0.0'
__author__ = 'Blockchain Middleware Team'

# 适配器注册表
ADAPTER_REGISTRY = {
    'fisco_bcos': FiscoBcosAdapter,
    'chainmaker': ChainMakerAdapter,
    'jd_chain': JDChainAdapter,
    'xuperchain': XuperChainAdapter,
    'thanos': ThanosAdapter
}

# 支持的区块链平台列表
SUPPORTED_CHAINS = list(ADAPTER_REGISTRY.keys())

def get_adapter_class(chain_type: str):
    """根据链类型获取适配器类"""
    if chain_type not in ADAPTER_REGISTRY:
        raise ValueError(f"Unsupported chain type: {chain_type}. Supported types: {SUPPORTED_CHAINS}")
    return ADAPTER_REGISTRY[chain_type]

def create_adapter(chain_type: str, config: dict):
    """创建适配器实例"""
    adapter_class = get_adapter_class(chain_type)
    return adapter_class(config)

def list_supported_chains():
    """列出支持的区块链平台"""
    return SUPPORTED_CHAINS.copy()

__all__ = [
    'IBlockchainAdapter',
    'BaseBlockchainAdapter',
    'FiscoBcosAdapter',
    'ChainMakerAdapter',
    'JDChainAdapter',
    'XuperChainAdapter',

    'EthereumAdapter',
    'ADAPTER_REGISTRY',
    'SUPPORTED_CHAINS',
    'get_adapter_class',
    'create_adapter',
    'list_supported_chains'
]